{extend name="public/base" /}
{block name="body"}
<div class="layui-row layui-col-space15">
    <div class="layui-col-md4">
        <div class="layui-card">
            <div class="layui-card-header">快捷方式</div>
            <div class="layui-card-body">
                <div class="layui-carousel layadmin-carousel layadmin-shortcut">
                    <ul class="layui-row layui-col-space10">
                        <li class="layui-col-xs4">
                            <a href="{:url('document/index')}">
                                <i class="layui-icon layui-icon-template-1"></i>
                                <cite>文章列表</cite>
                            </a>
                        </li>
                        <li class="layui-col-xs4">
                            <a href="{:url('documentcategory/index')}">
                                <i class="layui-icon layui-icon-tabs"></i>
                                <cite>栏目分类</cite>
                            </a>
                        </li>
                        <li class="layui-col-xs4">
                            <a href="{:url('config/groups')}">
                                <i class="layui-icon layui-icon-set"></i>
                                <cite>网站配置</cite>
                            </a>
                        </li>
                        <li class="layui-col-xs4">
                            <a href="{:url('adminauthgroup/index')}">
                                <i class="layui-icon layui-icon-auz"></i>
                                <cite>权限管理</cite>
                            </a>
                        </li>
                        <li class="layui-col-xs4">
                            <a href="{:url('adminactionlog/actionlog')}">
                                <i class="layui-icon layui-icon-date"></i>
                                <cite>行为日志</cite>
                            </a>
                        </li>
                        <li class="layui-col-xs4">
                            <a href="{:url('databases/index?type=export')}">
                                <i class="layui-icon layui-icon-component"></i>
                                <cite>数据库管理</cite>
                            </a>
                        </li>
                    </ul>
                </div>

            </div>
        </div>
    </div>
    <div class="layui-col-md4">
        <div class="layui-card">
            <div class="layui-card-header">数据统计</div>
            <div class="layui-card-body">

                <div class="layui-carousel layadmin-carousel layadmin-backlog">
                    <ul class="layui-row layui-col-space10">
                        <li class="layui-col-xs6">
                            <a class="layadmin-backlog-body">
                                <h3>已添加文章</h3>
                                <p><cite>{$articleCount}</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-xs6">
                            <a class="layadmin-backlog-body">
                                <h3>已添加分类</h3>
                                <p><cite>{$categoryCount}</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-xs6">
                            <a class="layadmin-backlog-body">
                                <h3>后台管理员</h3>
                                <p><cite>{$memberCount}</cite></p>
                            </a>
                        </li>
                        <li class="layui-col-xs6">
                            <a class="layadmin-backlog-body">
                                <h3>行为日志</h3>
                                <p><cite>{$actionlogCount}</cite></p>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>

    </div>
    <div class="layui-col-md4">
        <div class="layui-card">
            <div class="layui-card-header">版本信息</div>
            <div class="layui-card-body layui-text">
                <table class="layui-table">
                    <colgroup>
                        <col width="100">
                        <col>
                    </colgroup>
                    <tbody>
                    <tr>
                        <td>当前版本</td>
                        <td>
                            v{:config('HULA_VERSION')}
                            <a href="{:url('update/update_check')}" id="lbtn-update" style="padding-left: 5px;">检查更新</a>
                        </td>
                    </tr>
                    <tr>
                        <td>系统环境</td>
                        <td>
                            {:getenv('OS')} / PHP V{php}echo PHP_VERSION{/php}
                        </td>
                    </tr>
                    <tr>
                        <td>主要特色</td>
                        <td>专注于企业网站建设 / 清爽 / 极简</td>
                    </tr>
                    <tr>
                        <td>获取渠道</td>
                        <td style="padding-bottom: 0;">
                            <div class="layui-btn-container">
                                <a href="http://www.hulaxz.com/article/lists/id/146.html" target="_blank" class="layui-btn layui-btn-danger">模板教程</a>
                                <a href="{:url('sitemap')}" target="_blank" class="layui-btn layui-btn-normal">生成站点地图</a>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
    {if config('WEB_TONGJI')==1}
<div class="layui-row">
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">数据概览</div>
            <div class="layui-card-body">
                <div class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade" lay-filter="LAY-index-dataview">
                    <div carousel-item id="LAY-index-dataview">
                        <div><i class="layui-icon layui-icon-loading1 layadmin-loading"></i></div>
                        <div></div>
                    </div>
                </div>

            </div>
        </div>
        <div class="layui-card">
            <div class="layui-tab layui-tab-brief layadmin-latestData">
                <ul class="layui-tab-title">
                    <li class="layui-this">Top10受访页面</li>
                </ul>
                <div class="layui-tab-content">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>排名</th>
                            <th>受访页面</th>
                            <th>浏览量（PV）</th>
                            <th>占比</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="top10" id="vo"}
                        <tr>
                            <td>{$i}</td>
                            <td><a class="layui-table-link" target="_blank" href="{$vo['url']}">{$vo.title}</a></td>
                            <td>{$vo.pv}</td>
                            <td>{:sprintf("%.1f",($vo.pv/$totalPv)*100)}%</td>
                        </tr>
                        {/volist}

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
    {/if}
</div>

<div style="text-shadow:1px 1px 0px #fff;padding:20px 0;color:#bbb;width:100%;left:0;text-align: center;">Power By HulaCWMS v{:config('HULA_VERSION')} &copy; <a href="http://www.zhuopro.com/" target="_blank">灼灼文化</a></div>

{/block}
{block name="script"}
<script>
    $('#lbtn-update').click(function () {
       zzpost($(this).attr('href'),null,function (data) {
           if(!data.data){
               zzSuccess(data.msg);
           }
           else{
               var updateConfirm=top.layer.confirm('发现新版本V'+data.data.version+'，是否更新？更新前建议备份网站程序和数据库！', {
                   btn: ['更新','取消'] //按钮
               }, function(){
                   top.layer.close(updateConfirm);
                   top.layer.open({
                       type:2,
                       title:"更新系统",
                       area: ['600px','415px'], //宽高
                       content:"{:url('update/index')}"
                   });
               }, function(){

               });
           }

           return true;
       }) ;
       return false;
    });


    layui.config({
        base: '__LIB__/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'echarts',"carousel"],function () {

        //生成统计图表begin {if config('WEB_TONGJI')==1}
        //生成0-23，24小时的时间段
        var hours=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23];
        //获取今日PV
        var pvList={:json_encode($pvList)};
        //获取今日UV
        var uvList={:json_encode($uvList)};

        //浏览图表数据
        var dvData=[[],[],[]];
        for(var x in hours){
            if(hours[x]<10){
                dvData[0].push('0'+hours[x]+':00');
            }
            else{
                dvData[0].push(hours[x]+':00');
            }

            if(pvList.length>0&&pvList[0].time==hours[x]){
                dvData[1].push(pvList[0].view);
                pvList.splice(0,1);
            }
            else{
                dvData[1].push(0);
            }

            if(uvList.length>0&&uvList[0].time==hours[x]){
                dvData[2].push(uvList[0].people);
                uvList.splice(0,1);
            }
            else{
                dvData[2].push(0);
            }
        }

        //安排最近一周的浏览趋势
        var data7Arr={:json_encode($dateArr)};
        var pv7List={:json_encode($pv7List)};
        var uv7List={:json_encode($uv7List)};
        var dv7Data=[[],[],[]];
        for(var x in data7Arr){
            dv7Data[0].push(data7Arr[x]);

            if(pv7List.length>0&&pv7List[0].date.indexOf(data7Arr[x])>-1){
                dv7Data[1].push(pv7List[0].view);
                pv7List.splice(0,1);
            }
            else{
                dv7Data[1].push(0);
            }

            if(uv7List.length>0&&uv7List[0].date.indexOf(data7Arr[x])>-1){
                dv7Data[2].push(uv7List[0].view);
                uv7List.splice(0,1);
            }
            else{
                dv7Data[2].push(0);
            }
        }
        var e = layui.$, t = (layui.admin, layui.carousel), a = layui.element, i = layui.device();
        e(".layadmin-carousel").each(function () {
            var a = e(this);
            t.render({
                elem: this,
                width: "100%",
                arrow: "none",
                interval: a.data("interval"),
                autoplay: a.data("autoplay") === !0,
                trigger: i.ios || i.android ? "click" : "hover",
                anim: a.data("anim")
            })
        });
        var e = layui.$, t = layui.admin, a = layui.carousel, i = layui.echarts, l = [], n = [{
            title: {text: "今日网站访问趋势", x: "center", textStyle: {fontSize: 14}},
            tooltip: {trigger: "axis"},
            legend: {data: ["", ""]},
            xAxis: [{
                type: "category",
                boundaryGap: !1,
                data: dvData[0]
            }],
            yAxis: [{type: "value"}],
            series: [{
                name: "浏览量（PV）",
                type: "line",
                smooth: !0,
                itemStyle: {normal: {areaStyle: {type: "default"}}},
                data: dvData[1]
            }, {
                name: "访客量（UV）",
                type: "line",
                smooth: !0,
                itemStyle: {normal: {areaStyle: {type: "default"}}},
                data: dvData[2]
            }]
        }, {
            title: {text: "最近一周网站访问趋势", x: "center", textStyle: {fontSize: 14}},
            tooltip: {trigger: "axis"},
            legend: {data: ["", ""]},
            xAxis: [{
                type: "category",
                boundaryGap: !1,
                data: dv7Data[0]
            }],
            yAxis: [{type: "value"}],
            series: [{
                name: "浏览量（PV）",
                type: "line",
                smooth: !0,
                itemStyle: {normal: {areaStyle: {type: "default"}}},
                data: dv7Data[1]
            }, {
                name: "访客量（UV）",
                type: "line",
                smooth: !0,
                itemStyle: {normal: {areaStyle: {type: "default"}}},
                data: dv7Data[2]
            }]
        }], r = e("#LAY-index-dataview").children("div"), o = function (e) {
            l[e] = i.init(r[e], layui.echartsTheme), l[e].setOption(n[e]), t.resize(function () {
                l[e].resize()
            })
        };
        if (r[0]) {
            o(0);
            var d = 0;
            a.on("change(LAY-index-dataview)", function (e) {
                o(d = e.index)
            }), layui.admin.on("side", function () {
                setTimeout(function () {
                    o(d)
                }, 300)
            }), layui.admin.on("hash(tab)", function () {
                layui.router().path.join("") || o(d)
            })
        }
        //生成统计图表end  {/if}


    });
</script>
{/block}
